<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../commons/commons.jsp"%>
<!DOCTYPE html>
	<head>
		<meta charset="utf-8" />
		<title>后台</title>
		<script src="${ctx }/js/city.js"></script>
		<script src="${ctx }/static/js/crud.js"></script>
	</head>

	<body>
	<form action="${ctx }/site/list.do" id="submit-form">
	<div class="page-body">
		<div class="row">
			<div class="col-xs-12 col-md-12">
				<div class="widget">
					<div class="widget-header ">
						<span class="widget-caption">用户提交问题管理</span>
					</div>
						<table class="table table-striped table-bordered table-hover"
							id="simpledatatable" style="text-align:center;">
							<thead>
								<tr>
									<th>序号</th>
									<th>姓名</th>
									<th>性别</th>
									<th>邮箱</th>
									<th>联系方式</th>
									<th>所提问题</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								 <c:forEach items="${pagination.rows }" var="item" varStatus="status">
                                      <tr>
                                          <td>${status.count}</td>
                                          <td>${item.name}</td>
                                          <td>
                                          	<c:if test="${item.sex =='0'}">
                                          			女
                                          	</c:if>
                                          	<c:if test="${item.sex =='1'}">
                                          			男
                                          	</c:if>
                                          </td>
                                          <td>${item.email}</td>
                                          <td>${item.phone}</td>
                                          <td>${item.question}</td>
                                      	  <td>
                                          	 <a href="javascript:void(0)" class="btn btn-danger btn-xs delete" onclick="del('${item.id}')"><i class="fa fa-trash-o"></i>忽略/删除</a>
                                          </td>
                                      </tr>
                                </c:forEach>
							</tbody>
						</table>
						<%@include file="../commons/page.jsp"%>
					</div>
				</div>
			</div>
		</div>
	</form>
</body>
<script type="text/javascript">
	function del(id){
			bootbox.confirm("你确定删除该问题吗?", function(result) {
				if(result){
					var url = '${ctx }' + "/question/del.do";
				var sendData = {
					"qid" : id
				};
				$.get(url, sendData, function(backData) {
					if (backData.status == 1) {
						window.location.href="${ctx }/question/list.do";
					} else {
						warningAlert("删除操作出现错误，暂时无法删除");
					}
				});
				}
			});
        }
</script>
</html>